<template>
  <div>
    <div class="banner" @click="handleBannerClick">
      <img class="banner-img" :src="bannerImg"/>
      <div class="banner-info">
        <div class="banner-title">{{sightName}}</div>
        <div class="banner-video">
          视频<span class="iconfont banner-icon">&#xe662;</span>
        </div>
      </div>
    </div>
    <fade-animation>
      <common-gallary :imgs="bannerImgs" v-show="showGallary" @closeBanner="handleGallaryClose"/>
    </fade-animation>
  </div>
</template>

<script>
import CommonGallary from 'common/gallary/Gallary'
import FadeAnimation from 'common/fade-animation/FadeAnimation'
export default {
  name: 'DetailBanner',
  props: {
    bannerImg: String,
    sightName: String,
    bannerImgs: Array
  },
  components: {
    CommonGallary,
    FadeAnimation
  },
  data () {
    return {
      showGallary: false
    }
  },
  methods: {
    handleBannerClick () {
      this.showGallary = true
    },
    handleGallaryClose () {
      this.showGallary = false
    }
  }
}
</script>

<style lang="stylus" scoped>
  .banner
    position: relative
    // 图片长宽自适应设置
    overflow: hidden
    width: 100%
    height:0
    padding-bottom: 55%
    background: #eee
  .banner-img
    width: 100%
  .banner-info
    display: flex
    position: absolute
    left: 0
    right: 0
    bottom: 0
    line-height: .6rem
    color: #fff
    background-image: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8))
    .banner-title
      float: 1
      font-size: .36rem
      padding: .4rem .2rem
      /*margin-top: .8rem*/
    .banner-video
      position: absolute;
      bottom: .36rem;
      right: .2rem;
      z-index: 9;
      width: 1.5rem;
      color: #fff;
      font-size: .36rem;
      text-align: right;
      text-shadow: 0 1px 2px rgba(0,0,0,0.70);
      .banner-icon
        font-size: .32rem
</style>
